class Solution:
    def numDecodings(self, s: str) -> int:

        if s[0] =='0':
            return 0
        l = len(s)
        if l ==1:
            return 1
        if l == 2 and s[1] =='0' :
            if s[0] <'3':
                return 1
            else:
                return 0
        dp = [0] * (l+1)
        dp[0] =1
        for i in range(1,l+1):
            if s[i-1] !='0' :
                if i ==l:
                    dp[i] = dp[i-1]
                else:
                    print(s[i-1])
                    dp[i] += dp[i-1]
            if i>1 and s[i-2]!='0' and s[i-2:i] >= "10" and s[i-2:i] <"27":
                print(s[i-2:i])
                dp[i] += dp[i-2]
        print(dp)
        return dp[l]

if __name__ == '__main__':
    s= "2101"
    solution = Solution()
    val = solution.numDecodings(s)
    print(val)